<template>
  <div class="generalize">
    <div v-if="!$store.state.isbusNewsDitle">
      <div>
        <div
          class="adu_box"
          v-for="item in sonList"
          :key="item.id"
        >
          <img
            class="adu_img"
            :src="item.img"
            alt=""
          >
          <div class="adu_right">
            <p
              class="right_title pointer activ_list"
              @click="handDitle(item)"
            >{{item.title}}</p>
            <div class="right_cont">
              {{item.dp}}
            </div>
          </div>
        </div>
      </div>

      <div
        class="page_box"
        style="margin-top: 70px"
      >
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15]"
          :page-size="pageBid3.limit"
          layout="total, prev, pager, next, jumper"
          :total="pageBid3.totalCount"
        >
        </el-pagination>
      </div>
    </div>
    <transition name="fade">
      <div
        v-if="$store.state.isbusNewsDitle"
        class="busDitle_dog"
      >
        <mydetails
          :sonList="sonList"
          :dateils="dateils"
        ></mydetails>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "generalize.vue",
  watch: {
    sonList(newlIst, olist) {
      newlIst.forEach(item => {
        item.img = this.$store.state.baseUrl + item.img;
      });
    },
    count(newlIst, olist) {
      this.pageBid3.totalCount = newlIst;
    }
  },
  props: {
    count: {
      type: Number
    },
    sonList: {
      type: Array
    }
  },
  mounted() {
    if (this.count != 0) {
      this.pageBid3.totalCount = this.count;
    }
  },
  data() {
    return {
      pageBid3: {
        start: 1,
        limit: 10,
        totalCount: 0,
        tatalpage: 0
      }
    };
  },

  methods: {
    handDitle(item) {
      this.dateils = item;
      this.$store.commit("handBus", true);
    },
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.$emit("handSonNav", this.$parent.activeId, val, 10);
    }
  }
};
</script>

<style lang='scss' scoped>
@mixin ellipsis($rowCount: 1) {
  @if $rowCount <=1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  } @else {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: $rowCount;
    -webkit-box-orient: vertical;
  }
}

.adu_box {
  display: flex;
  .adu_img {
    margin-right: 31px;
    width: 327px;
    height: 116px;
  }
  .adu_right {
    .right_title {
      color: #333;
      font-size: 16px;
      margin-bottom: 40px;
    }
    .right_cont {
      color: #808080;
      font-size: 14px;
      line-height: 27px;
      @include ellipsis(2);
    }
  }
}
</style>
